This Method or Property Does Not Exist Error

You used a syntax that implies that a term is a method or property, but it does not exist. It also occurs when you use a variable in an assignment statement but omit the equals sign, making it appear that it is a method or property.


Examples

Calling a method that has not been defined:

Dim aFiles(3) as FolderItem
aFiles.List //no such thing

Assigning a value to a variable that has not been declared using a Dim statement

i=10

:

This is the Action event handler of a PushButton; the user wants to display the caption property of the PushButton.

MsgBox caption //should be me.caption*

Trying to set in code a property that can only be set in the Properties pane. The following line of code tries to set the value of the Bold property of a MenuItem, but REALbasic does not recognize the Bold property in code.

SearchFind.Bold= True

Using Me in a method or function that is not attached to an object. The following method tries to return the caption property of the calling PushButton, but this is not permitted.

Function myCaption() as String
Return Me.Caption

You can only access the calling object's properties using Me within an event handler belonging to that object.

The programmer intended to declare aNames as an array in the Dim statement but forgot to do so.

Dim aNames as String
aNames.Append "Walter Kerr"

Trying to assign a value to a Private or Protected property that is out of scope. For example, the following line tries to assign a value to a Private property of a module from a window:

myPrivateProperty=56

See Also

Dim statement.